// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import 'babel-polyfill'
import 'url-search-params-polyfill'
import './style.scss'
import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store'
import ElementUI from 'element-ui'
// import 'element-ui/lib/theme-chalk/index.css'
import './bootstrap-scss/bootstrap.scss'

import VeeValidate from 'vee-validate'
// 自定义验证器
import './validate.js'
// 参数转换插件
import paramsConvert from './plugins/paramsConvert'
// 常用工具插件
import Util from './plugins/Util'
// 错误处理
import errorPage from './plugins/errorPage'

// 图片预览
// 需要全局以组件实例调用使用的组件
import './plugins/imgViewer'

// 图片懒加载
import VueLazyload from 'vue-lazyload'

Vue.config.productionTip = false
Vue.config.devtools = true

Vue.use(VeeValidate)
Vue.use(paramsConvert)
Vue.use(Util)
Vue.use(ElementUI)
Vue.use(errorPage)
Vue.use(VueLazyload, {
  preLoad: 1.3,
  error: 'static/404.png',
  loading: 'static/mohutupian.png',
  attempt: 1,
  listenEvents: [ 'scroll' ]
})

// router.beforeEach(function (to, from, next) {
//   gtag('config', "UA-126457129-1", { page_path: to.name })
//   next()
// })

Vue.component('scroll', (resolve) => { require(['./components/scroll/Scroll'], resolve) })
Vue.component('comments', (resolve) => { require(['./components/server/Comments'], resolve) })

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})
